package org.ntu.wkw.ip.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/GetChatroomsByLanguage")
public class GetChatroomsByLanguage extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public GetChatroomsByLanguage() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		this.doPost(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		response.setContentType("text/xml;charse=UTF-8");
		System.out
				.println("language id:" + request.getParameter("language_id"));
		PrintWriter out = response.getWriter();
		// out.print("<?xml version='1.0' encoding='ISO-8859-1'?>");
		out.write("[{name:\"CP's Game Room\",owner:\"cp-love-2-play\",description:\"Let's play games here\"},{name:\"Chit chat\",owner:\"ms_chat_chit\",description:\"Chat about anything\"},{name:\"POI@SG\",owner:\"a_guy_from_sg\",description:\"What are the places to visit in Singapore\"}]");

		out.flush();
		out.close();
	}

}
